<?php
class App_Tpl_Form_Field_Mediatags extends App_Tpl_Form_Field_Text
{
	public function PreparePost($fieldPostData, $params)
	{
		return Mozg_Mapper::Get('Tags')->GetFilteredArr((string)$fieldPostData);
	}

	protected function PrepareOut($fieldData, $params)
	{
		$fieldData = is_array($fieldData) ? implode(', ', $fieldData) : $fieldData;
		$fieldData = trim($fieldData, ', ');
		if (strlen($fieldData)) $fieldData .= ', ';
		
		return $fieldData;
	}
	
    protected function RenderField()
    {
    	return $this->render('form/field/_mediatags.phtml');
    }
}